package com.max.xihu.concurrent.day01;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;

/**
 * @Author: Max
 * @Date: 2020-06-29 23:15
 * @Description:
 */
public class ThreadMXBeanDemo {

    public static void main(String[] args) {
        ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
        ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(false, false);
        for (ThreadInfo info : threadInfos){
            System.out.println("["+info.getThreadId()+"] "+info.getThreadName());
        }
    }
}
